package com.aiyige.base.db.table;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Created by zhuyakun on 2017/11/29.
 */
@DatabaseTable(tableName = "DownloadModel")
public class DownloadModel {
    public static final String ID_FIELD = "id";
    public static final String CONTROL_OPTION_FIELD = "controlOption";
    public static final String PROGRESS_STATUS_FIELD = "progressStatus";
    public static final String USER_ID_FIELD = "userId";
    public static final String GOODS_ID_FIELD = "momentId";
    public static final String MODEL_TYPE_FIELD = "modelType";
    public static final String COVER_REMOTE_URL = "coverRemoteUrl";
    public static final String COVER_LOCAL_URL = "coverLocalUrl";
    public static final String DOWNLOAD_DATE_FIELD = "downloadDate";
    public static final String TITLE_FIELD = "title";
    public static final String AUTHOR_NAME_FIELD = "authorName";
    public static final String MEDIA_NUM = "mediaNum";
    public static final String PLAY_INDEX = "playIndex";
    public static final String PLAY_POSITION = "playPosition";
    @DatabaseField(id = true, columnName = ID_FIELD)
    String id;
    @DatabaseField(columnName = USER_ID_FIELD)
    String userId;
    @DatabaseField(columnName = TITLE_FIELD)
    String title;
    @DatabaseField(columnName = COVER_REMOTE_URL)
    String coverRemoteUrl;
    @DatabaseField(columnName = COVER_LOCAL_URL)
    String coverLocalUrl;
    @DatabaseField
    double price;
    @DatabaseField
    String courseType;
    @DatabaseField
    String learnTarget;
    @DatabaseField
    String suitablePeople;
    @DatabaseField
    String teacher;
    @DatabaseField
    int interestCategory;
    @DatabaseField
    String guarantee;
    @DatabaseField
    String tag;
    @DatabaseField
    String introduction;
    @DatabaseField(columnName = PROGRESS_STATUS_FIELD)
    int progressStatus;
    @DatabaseField(columnName = CONTROL_OPTION_FIELD)
    int controlOption;
    @DatabaseField(columnName = GOODS_ID_FIELD)
    String goodsId;
    @DatabaseField
    String location;
    @DatabaseField
    long releaseDate;
    @DatabaseField(columnName = MEDIA_NUM)
    int mediaNum;
    @DatabaseField(columnName = DOWNLOAD_DATE_FIELD)
    long downloadDate;
    @DatabaseField(columnName = MODEL_TYPE_FIELD)
    int modelType;
    @DatabaseField
    String authorId;
    @DatabaseField(columnName = AUTHOR_NAME_FIELD)
    String authorName;
    @DatabaseField
    String authorAvatar;
    @DatabaseField(columnName = PLAY_INDEX)
    long playIndex;
    @DatabaseField(columnName = PLAY_POSITION)
    long playPosition;

    boolean edit = false;
    boolean selected = false;
    long totalDuration = 0;


    public DownloadModel() {
    }

    private DownloadModel(Builder builder) {
        setId(builder.id);
        setUserId(builder.userId);
        setTitle(builder.title);
        setCoverRemoteUrl(builder.coverRemoteUrl);
        setCoverLocalUrl(builder.coverLocalUrl);
        setPrice(builder.price);
        setCourseType(builder.courseType);
        setLearnTarget(builder.learnTarget);
        setSuitablePeople(builder.suitablePeople);
        setTeacher(builder.teacher);
        setInterestCategory(builder.interestCategory);
        setGuarantee(builder.guarantee);
        setTag(builder.tag);
        setIntroduction(builder.introduction);
        setProgressStatus(builder.progressStatus);
        setControlOption(builder.controlOption);
        setGoodsId(builder.goodsId);
        setLocation(builder.location);
        setReleaseDate(builder.releaseDate);
        setMediaNum(builder.mediaNum);
        setDownloadDate(builder.downloadDate);
        setModelType(builder.modelType);
        setAuthorId(builder.authorId);
        setAuthorName(builder.authorName);
        setAuthorAvatar(builder.authorAvatar);
        setEdit(builder.edit);
        setSelected(builder.selected);
        setTotalDuration(builder.totalDuration);
        setPlayIndex(builder.playIndex);
        setPlayPosition(builder.playPosition);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    public long getPlayIndex() {
        return playIndex;
    }

    public void setPlayIndex(long playIndex) {
        this.playIndex = playIndex;
    }

    public long getPlayPosition() {
        return playPosition;
    }

    public void setPlayPosition(long playPosition) {
        this.playPosition = playPosition;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCoverRemoteUrl() {
        return coverRemoteUrl;
    }

    public void setCoverRemoteUrl(String coverRemoteUrl) {
        this.coverRemoteUrl = coverRemoteUrl;
    }

    public String getCoverLocalUrl() {
        return coverLocalUrl;
    }

    public void setCoverLocalUrl(String coverLocalUrl) {
        this.coverLocalUrl = coverLocalUrl;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getCourseType() {
        return courseType;
    }

    public void setCourseType(String courseType) {
        this.courseType = courseType;
    }

    public String getLearnTarget() {
        return learnTarget;
    }

    public void setLearnTarget(String learnTarget) {
        this.learnTarget = learnTarget;
    }

    public String getSuitablePeople() {
        return suitablePeople;
    }

    public void setSuitablePeople(String suitablePeople) {
        this.suitablePeople = suitablePeople;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public int getInterestCategory() {
        return interestCategory;
    }

    public void setInterestCategory(int interestCategory) {
        this.interestCategory = interestCategory;
    }

    public String getGuarantee() {
        return guarantee;
    }

    public void setGuarantee(String guarantee) {
        this.guarantee = guarantee;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public int getProgressStatus() {
        return progressStatus;
    }

    public void setProgressStatus(int progressStatus) {
        this.progressStatus = progressStatus;
    }

    public int getControlOption() {
        return controlOption;
    }

    public void setControlOption(int controlOption) {
        this.controlOption = controlOption;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public long getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(long releaseDate) {
        this.releaseDate = releaseDate;
    }

    public int getMediaNum() {
        return mediaNum;
    }

    public void setMediaNum(int mediaNum) {
        this.mediaNum = mediaNum;
    }

    public long getDownloadDate() {
        return downloadDate;
    }

    public void setDownloadDate(long downloadDate) {
        this.downloadDate = downloadDate;
    }

    public int getModelType() {
        return modelType;
    }

    public void setModelType(int modelType) {
        this.modelType = modelType;
    }

    public String getAuthorId() {
        return authorId;
    }

    public void setAuthorId(String authorId) {
        this.authorId = authorId;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public String getAuthorAvatar() {
        return authorAvatar;
    }

    public void setAuthorAvatar(String authorAvatar) {
        this.authorAvatar = authorAvatar;
    }

    public boolean isEdit() {
        return edit;
    }

    public void setEdit(boolean edit) {
        this.edit = edit;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public long getTotalDuration() {
        return totalDuration;
    }

    public void setTotalDuration(long totalDuration) {
        this.totalDuration = totalDuration;
    }


    public static final class Builder {
        private String id;
        private String userId;
        private String title;
        private String coverRemoteUrl;
        private String coverLocalUrl;
        private double price;
        private String courseType;
        private String learnTarget;
        private String suitablePeople;
        private String teacher;
        private int interestCategory;
        private String guarantee;
        private String tag;
        private String introduction;
        private int progressStatus;
        private int controlOption;
        private String goodsId;
        private String location;
        private long releaseDate;
        private int mediaNum;
        private long downloadDate;
        private int modelType;
        private String authorId;
        private String authorName;
        private String authorAvatar;
        private boolean edit;
        private boolean selected;
        private long totalDuration;
        private long playIndex;
        private long playPosition;

        private Builder() {
            id = "";
            userId = "";
            title = "";
            coverRemoteUrl = "";
            coverLocalUrl = "";
            price = 0;
            courseType = "";
            learnTarget = "";
            suitablePeople = "";
            teacher = "";
            interestCategory = 0;
            guarantee = "";
            tag = "";
            introduction = "";
            progressStatus = 0;
            controlOption = 0;
            goodsId = "";
            location = "";
            releaseDate = 0;
            mediaNum = 0;
            downloadDate = 0;
            modelType = 0;
            authorId = "";
            authorName = "";
            authorAvatar = "";
            edit = false;
            selected = false;
            totalDuration = 0;
            playIndex = -1;
            playPosition = -1;
        }

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder userId(String userId) {
            this.userId = userId;
            return this;
        }

        public Builder title(String title) {
            this.title = title;
            return this;
        }

        public Builder playIndex(long playIndex) {
            this.playIndex = playIndex;
            return this;
        }

        public Builder playPosition(long playPosition) {
            this.playPosition = playPosition;
            return this;
        }

        public Builder coverRemoteUrl(String coverRemoteUrl) {
            this.coverRemoteUrl = coverRemoteUrl;
            return this;
        }

        public Builder coverLocalUrl(String coverLocalUrl) {
            this.coverLocalUrl = coverLocalUrl;
            return this;
        }

        public Builder price(double price) {
            this.price = price;
            return this;
        }

        public Builder courseType(String courseType) {
            this.courseType = courseType;
            return this;
        }

        public Builder learnTarget(String learnTarget) {
            this.learnTarget = learnTarget;
            return this;
        }

        public Builder suitablePeople(String suitablePeople) {
            this.suitablePeople = suitablePeople;
            return this;
        }

        public Builder teacher(String teacher) {
            this.teacher = teacher;
            return this;
        }

        public Builder interestCategory(int interestCategory) {
            this.interestCategory = interestCategory;
            return this;
        }

        public Builder guarantee(String guarantee) {
            this.guarantee = guarantee;
            return this;
        }

        public Builder tag(String tag) {
            this.tag = tag;
            return this;
        }

        public Builder introduction(String introduction) {
            this.introduction = introduction;
            return this;
        }

        public Builder progressStatus(int progressStatus) {
            this.progressStatus = progressStatus;
            return this;
        }

        public Builder controlOption(int controlOption) {
            this.controlOption = controlOption;
            return this;
        }

        public Builder goodsId(String goodsId) {
            this.goodsId = goodsId;
            return this;
        }

        public Builder location(String location) {
            this.location = location;
            return this;
        }

        public Builder releaseDate(long releaseDate) {
            this.releaseDate = releaseDate;
            return this;
        }

        public Builder mediaNum(int mediaNum) {
            this.mediaNum = mediaNum;
            return this;
        }

        public Builder downloadDate(long downloadDate) {
            this.downloadDate = downloadDate;
            return this;
        }

        public Builder modelType(int modelType) {
            this.modelType = modelType;
            return this;
        }

        public Builder authorId(String authorId) {
            this.authorId = authorId;
            return this;
        }

        public Builder authorName(String authorName) {
            this.authorName = authorName;
            return this;
        }

        public Builder authorAvatar(String authorAvatar) {
            this.authorAvatar = authorAvatar;
            return this;
        }

        public Builder edit(boolean edit) {
            this.edit = edit;
            return this;
        }

        public Builder selected(boolean selected) {
            this.selected = selected;
            return this;
        }

        public Builder totalDuration(long totalDuration) {
            this.totalDuration = totalDuration;
            return this;
        }

        public DownloadModel build() {
            return new DownloadModel(this);
        }
    }
}
